<%@page import="hyl.ext.base.MySession"%>
<%@page import="com.servlet.M2"%>
<%@page language="java" contentType="application/json;charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page	import="hyl.core.db.*,com.servlet.My,hyl.core.info.Content,hyl.core.MyFun"%>
<%
//查询列表数据
	MySession tk = My.getSession(request,response);
	int role = tk.getRoleid();
	int index = MyFun.str2int(request.getParameter("rs_index"));
	int size = MyFun.str2int(request.getParameter("rs_size"));
	String aname = request.getParameter("aname");
	String state = request.getParameter("state");
	Content ct = new Content();
	////////////////////////////////dao//////////////////////////////////
	MySqlSelect count = MySqlSelect	.getInstance("SELECT COUNT(1) AS total FROM app a  WHERE 1=1 ");
	
	String sql = " SELECT a.t0,a.t1,a.t2,a.tm0,a.dt0, a.i0,a.t3,a.id,a.appid,a.t15 FROM app a WHERE 1=1 {1} ORDER BY a.id DESC {2} ";

	MySqlSelect2 select = MySqlSelect2.getInstance(sql);
	SelectWhere sw = new SelectWhere();
	sw.addLike(" and a.t0 like ?",aname);
	sw.add(" and a.i0=?", state);
	//sw.add(" and ", tk.getUserId());
	count.addParams(sw);
	select.addParams(1, sw);
	select.fromto(2, index, size);
	
	ct.setCode(1, "查询成功");
	ct.iniBodys(count.getMap());
	
	ct.addBodyItem("_rs", select.getList2D());
	//MyFun.printJson(ct);
	out.print(ct.toJsonString());
%>